import util.events.event as evn
from pygame.locals import *


class GameController():
    #Translates key inputs to game events
    
    def __init__(self, evManager):
        self.evManager = evManager
        self.evManager.RegisterListener(self)
    
    def Notify(self, event):
        if isinstance( event, evn.TickEvent ):
            #Handle Input Events
            for event in pygame.event.get():
                ev = None
                if event.type == QUIT:
                    ev = evn.QuitEvent()                 
                elif event.type == KEYDOWN \
                and event.key == K_v:
                    ev = evn.ToggleVisionEvent()
                if ev:
                    self.evManager.Post(ev)